﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>系统登录</title>
    <link href="~/content/adminlte/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
    <script src="~/content/adminlte/bootstrap/js/bootstrap.min.js"></script>
    <link href="~/Content1/css/signin.css" rel="stylesheet" />
    <script src="~/content/ui/global/jQuery/jquery-2.2.3.min.js"></script>
    <script src="~/content/ui/global/layer/layer.js"></script>
    <script src="~/content/js/md5/jquery.md5.js"></script>
    <link href="~/content/css/signin.css" rel="stylesheet" />
</head>
<body>
    <div class="signin">
        
        <div class="signin-head"><img src="/content/ui/img/photos/girl1.jpg" alt="" style="width:100px" class="img-circle"></div>
        <form class="form-signin" role="form">
            <input type="text" class="form-control" id="username" placeholder="用户名" required autofocus />
            <input type="password" class="form-control" id="password" placeholder="密码" required />
            <button class="btn btn-lg btn-warning btn-block" id="login" type="button">登录</button>
            <label class="checkbox">
                <input type="checkbox" value="remember-me"> 记住我
            </label>
        </form>
    </div>

    <script src="~/content/js/tools.js"></script>
    <script type="text/javascript">
        (function ($) {
            $.login = {
                init: function () {
                    $("#login").click(function () {
                        var $name = $("#username");
                        var $pwd = $("#password");
                        if ($name.val() == "") {
                            layer.tips('请输入用户名', $name, { tips: [2, '#FF5722'] });
                        } else if ($pwd.val() == "") {
                            layer.tips('请输入密码', $pwd, { tips: [2, '#FF5722'] });
                        } else {
                            $(this).attr('disabled', 'disabled').text("loading...");
                            var parm = { "username": $.trim($name.val()), "password": $.md5($.trim($.trim($pwd.val()))) };
                            $.AjaxExt.post("/Login/CheckLogin", parm, function (data) {
                                if (data.state == "success") {
                                    $("#login").text("登录成功，正在跳转...");
                                    window.setTimeout(function () {
                                        window.location.href = "/Home/Index";
                                    }, 500);
                                } else {
                                    $("#login").removeAttr('disabled').text("登录");
                                    layer.alert(data.message, { icon: 2, title: '信息提示', closeBtn: 0, btn: 0, time: 2000 })
                                }
                            })
                        }

                    });
                    document.onkeydown = function (e) {
                        if (!e) e = window.event;
                        if ((e.keyCode || e.which) == 13) {
                            document.getElementById("login").focus();
                            document.getElementById("login").click();
                        }
                    }
                }
            };
            $(function () {
                $.login.init();
            })
        })(jQuery);

    </script>
</body>
</html>
